﻿using System;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Workflow;

namespace SPCustomMasterPage.ChildSiteInit
{
    /// <summary>
    /// Web Events
    /// </summary>
    public class ChildSiteInit : SPWebEventReceiver
    {
       /// <summary>
       /// A site was provisioned.
       /// </summary>
       public override void WebProvisioned(SPWebEventProperties properties)
       {
           //base.WebProvisioned(properties);
           SPWeb childSite = properties.Web;
           SPWeb topSite = childSite.Site.RootWeb;
           childSite.MasterUrl = topSite.MasterUrl;
           childSite.CustomMasterUrl = topSite.CustomMasterUrl;
           childSite.AlternateCssUrl = topSite.AlternateCssUrl;
           childSite.SiteLogoUrl = topSite.SiteLogoUrl;
           childSite.Update();
       }


    }
}
